<?php
	include_once('header.php');
	// start 处理上传表单
	if ($_SERVER['REQUEST_METHOD']=='POST') {
		$new_articles_num_per_page = (int)($_POST['articles_num_per_page']);
		$new_fujian_file_size = (int)($_POST['fujian_file_size']);
		$new_sidebar_num_comment = (int)($_POST['sidebar_num_comment']);
		$query_new_Anum = "update `setting` set `value`='".$new_articles_num_per_page."' where `name`='articles_num_per_page'";
		$query_new_fujian = "update `setting` set `value`='".$new_fujian_file_size."' where `name`='fujian_file_size'";
		$query_new_num_comment = "update `setting` set `value`='".$new_sidebar_num_comment."' where `name`='sidebar_num_comment'";
		$mysql_connection->query($query_new_fujian);
		$mysql_connection->query($query_new_Anum);
		$mysql_connection->query($query_new_num_comment);
	}
	// end 处理上传表单

	// start 获取设置信息
	$query_articles_num_per_page = "select * from `setting` where `name`='articles_num_per_page'";
	$result_articles_num_per_page = $mysql_connection->query($query_articles_num_per_page);
	$articles_num_per_page = $result_articles_num_per_page->fetch_assoc();
	$articles_num_per_page = $articles_num_per_page['value'];

	$query_fujian_file_size = "select * from `setting` where `name`='fujian_file_size'";
	$result_fujian_file_size = $mysql_connection->query($query_fujian_file_size);
	$fujian_file_size = $result_fujian_file_size->fetch_assoc();
	$fujian_file_size = $fujian_file_size['value'];

	$query_sidebar_num_comment = "select * from `setting` where `name`='sidebar_num_comment'";
	$result_sidebar_num_comment = $mysql_connection->query($query_sidebar_num_comment);
	$sidebar_num_comment = $result_sidebar_num_comment->fetch_assoc();
	$sidebar_num_comment = $sidebar_num_comment['value'];
	// end 获取获得设置信息
?>
<div id="content_b"><form action="<?php echo $_SERVER['PHP_SELF'];?>?message_box=阅读设置更新成功" method="post"><table width="100%">
	<tr><td>最新评论显示数量</td>
	<td><input type="text" class="input_text" name="sidebar_num_comment" value="<?php echo $sidebar_num_comment;?>" /></td></tr>
	<tr><td>博客页面最多显示日志篇数</td>
	<td><input type="text" class="input_text" name="articles_num_per_page" value="<?php echo $articles_num_per_page;?>" /></td></tr>
	<tr><td>上传附件上限</td>
	<td><input type="text" class="input_text" name="fujian_file_size" value="<?php echo $fujian_file_size;?>" /></td></tr>
</table>
<input type="submit" value="保存设置" />
</form></div>
<?php include_once('footer.php');?>
